import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'

export const constantRoutes = [
    {
        path: '/login',
        component: () => import('@/views/login'),
        hidden: true,
    },
    {
        path: '/403',
        name: '403',
        component: () => import('@/views/403'),
        hidden: true,
    },
    {
        path: '/404',
        name: '404',
        component: () => import('@/views/404'),
        hidden: true,
    },
]
export const asyncRoutes = [
    {
        path: '/',
        component: Layout,
        redirect: '/index',
        meta: {
            title: '首页',
            icon: 'home-4-line',
            affix: true,
        },
        children: [
            {
                path: 'index',
                name: 'Index',
                component: () => import('@/views/index'),
                meta: {
                    title: '首页',
                    icon: 'home-4-line',
                    affix: true,
                },
            },
        ],
    },
    {
        path: '/vab',
        component: Layout,
        redirect: '/vab/status',
        alwaysShow: true,
        meta: {
            title: '设备运维',
            icon: 'bus-2-line',
        },
        children: [
            {
                path: 'status',
                name: 'status',
                component: () => import('@/views/vab/status'),
                meta: {
                    title: '终端监控',
                    icon: 'table-2',
                },
            },
            {
                path: 'alarms',
                name: 'alarms',
                component: () => import('@/views/vab/alarms'),
                meta: {
                    title: '报警记录',
                    icon: 'remixicon-line',
                },
            },
        ],
    },
    {
        path: '/stat',
        name: 'Stat',
        component: Layout,
        redirect: '/error/404',
        meta: {
            title: '数据统计',
            icon: 'bar-chart-box-fill',
        },
        children: [
            {
                path: 'test',
                name: 'Test',
                component: () => import('@/views/test'),
                meta: {
                    title: '当班汇总',
                    icon: 'apps-line',
                },
            },
            {
                path: 'test1',
                name: 'Test1',
                component: () => import('@/views/test'),
                meta: {
                    title: '营收统计',
                    icon: 'table-2',
                },
            },
        ],
    },
    {
        path: '/analysis',
        name: 'Analysis',
        component: Layout,
        redirect: '/error/404',
        meta: {
            title: '数据分析',
            icon: 'cloud-line',
        },
        children: [
            {
                path: 'test3',
                name: 'Test3',
                component: () => import('@/views/403'),
                meta: {
                    title: '热门线路',
                    icon: 'apps-line',
                },
            },
            {
                path: 'test4',
                name: 'Test4',
                component: () => import('@/views/404'),
                meta: {
                    title: '繁忙时段',
                    icon: 'cloud-fill',
                },
            },
        ],
    },
    {
        path: '/*',
        redirect: '/404',
        hidden: true,
    },
]
const router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes,
})

export default router
